import { Card, Color, Equipment } from "../card";

/**
 * +1马
 */
export class PlusOneHourse extends Equipment {

    async use(): Promise<void> {
        if (this.cardProperties.owner) {
            this.cardProperties.owner.equipmentAreas.defendDistances = this.cardProperties.owner.equipmentAreas.defendDistances + 1
        }

        return super.use()
    }

    onDrop(): void {
        if (this.cardProperties.owner && this.hasEquip()) {
            this.cardProperties.owner.equipmentAreas.defendDistances = this.cardProperties.owner.equipmentAreas.defendDistances - 1
        }
        super.onDrop()
    }

    info(): string {
        return "+1马"
    }

    static areaIndex():number {
        return 2
    }

}

/**
 * -1马
 */
export class MinusOneHourse extends Equipment {

    async use(): Promise<void> {
        if (this.cardProperties.owner) {
            this.cardProperties.owner.equipmentAreas.actualDistance = this.cardProperties.owner.equipmentAreas.actualDistance + 1
        }

        return super.use()
    }

    onDrop(): void {
        if (this.cardProperties.owner && this.hasEquip()) {
            this.cardProperties.owner.equipmentAreas.actualDistance = this.cardProperties.owner.equipmentAreas.actualDistance - 1
        }
        super.onDrop()
    }

    info(): string {
        return "-1马"
    }

    static areaIndex():number {
        return 3
    }

}

export class Chitu extends MinusOneHourse {
    info(): string {
        return "赤兔"
    }
}

export class DaWan extends MinusOneHourse {
    info(): string {
        return "大宛"
    }
}

export class ZiXing extends MinusOneHourse {
    info(): string {
        return "梓骍"
    }
}

export class DiLu extends PlusOneHourse {
    info(): string {
        return "的卢"
    }
}

export class HuaLiu extends PlusOneHourse {
    info(): string {
        return "骅骝"
    }
}

export class JueYing extends PlusOneHourse {
    info(): string {
        return "绝影"
    }
}

export class ZhuaHuangFeiDian extends PlusOneHourse {
    info(): string {
        return "爪黄飞电"
    }
}
